<template>
	<layout :loading="loadingData" pageKey="banner" :title="data._id ? '修改导航':'新增导航'">
 
		<form @submit="submit" data-action="admin/banner/save" data-back="/pages/banner/list" data-clear="admin/banner/list">

<view class="w650">
		 <uploads title="轮播图" name="x.image_url" v-model="data.image_url" :count="1"></uploads>	
	      <inputs name="x.open_url|链接地址" title="链接地址" :value="data.open_url"></inputs>
			<inputs name="x.title|名称" title="名称" :value="data.title"></inputs>			
			<inputs name="x.sort|排序" title="排序" type="number" :value="data.sort"></inputs>
			
			<textareas title="描述" name="x.description|描述|empty" :value="data.description?data.description:''" :maxlength="200" placeholder="选填"></textareas>
			
			<switchs  name="x.status|是否有效" title="是否有效" v-model="data.status" ></switchs>
			<labels class="mt40">
				<inputs type="hidden" name="x._id" :value="id" v-if="id"></inputs>
				<button class="btn greenBg w80" form-type="submit">{{ !data._id ? '保存' : '修改'}}</button>
				<button class="btn grayBg line w80" @click="bcc.goBack()">取消</button>
			</labels>
			</view>
		</form>

	</layout>
</template>

<script>
	export default {
		data() {
			return {
				loadingData : true ,
				
				id : '' ,
				data : {					
				},
				
				
			}
		},
		
		onLoad(params) {
			this.id = params.id ;
			this.loadData();
			
		},
		
		methods: {
			
			submit:function(e){
				this.bcc.submit(e);
			},
			
			loadData : function(e){
				var that = this ;
				var data = {
					id : this.id 
				} ;
				this.bcc.call({
					url : 'admin/banner/info' ,
					data : data ,
					success : res => { 
						this.data = res.data || {};
						// this.typeList = res.typeList ;
						this.loadingData = false ;
					}
				});
			},
			
			
		}
	}
</script>

<style>

</style>
